<?php
/**
 * Created by dutuwang.net
 * User: adophper <hello@adophper.com>
 * Date: 2018/4/12
 * Time: 18:49
 */
?>
<div class="pisChart" style="position:relative; width: 100%; height: 100%;">
    <canvas id="<?=$div?>"></canvas>
</div>
<script>
    var <?=$div?> = document.getElementById("<?=$div?>").getContext("2d");
    var <?=$div?>_chart = new Chart(<?=$div?>, {
        type: 'pie',
        data: {
            labels: [<?="'".join("','", $label)."'"?>],//文字
            datasets: [{
                data: [<?="'".join("','", $value)."'"?>],//值
                backgroundColor: [<?="'".join("','", $color)."'"?>]//颜色
            }]
        },
        options: {
            legend: {
                position: 'right' //文字显示位置
            }
        }
    });
</script>